from apscheduler.schedulers.tornado import TornadoScheduler

sched = TornadoScheduler()


def crons2kwargs(cron: str) -> dict:
    d = {}
    cron_split = cron.split(' ')
    if len(cron_split) == 7:
        d['year'] = cron_split[-1]
    d['second'] = cron_split[0]
    d['minute'] = cron_split[1]
    d['hour'] = cron_split[2]
    d['day'] = cron_split[3]
    d['month'] = cron_split[4]
    d['day_of_week'] = cron_split[5]
    for k, v in d.copy().items():
        if v == '?':
            d.pop(k)
    return d



